<!DOCTYPE html>
<html
        xmlns:th="http://www.thymeleaf.org"
        xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
        layout:decorate="~{common/base}">

<!--公共CSS JS引用-->
<head th:include="/common/head :: commonHead('权限管理')"></head>
<body>
<!--自定义的页面内容-->
<div layout:fragment="index">
    <!--自定义JS-->
    <script th:src="@{~/js/biz/permission.js}" th:inline="javascript" type="text/javascript"></script>

    <style type="text/css">
        div#rMenu {
            position:absolute;
            visibility:hidden;
            top:0; text-align: left;
            padding:4px;
        }
        div#rMenu a {
            padding: 3px 15px 3px 15px;
            background-color: #cad4e6;
            vertical-align: middle;
            cursor: pointer;
        }
    </style>

    <section class="content-header">
        <h1>
            系统管理
            <small>权限管理</small>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">权限管理</h3>
                    </div>
                    <div class="box-body">
                        <div class="pull-left" style="border: 1px silver solid;width: 100%">
                            <ul id="menuTree" class="ztree"></ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!--添加Modal-->
    <div class="modal fade" id="addMenu">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="MenuTree.formReset();">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">添加权限</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="menuForm">
                        <input id="id" name="id" type="hidden">
                        <input id="pid" name="pid" type="hidden" value="0">
                        <input id="type" name="type"  type="hidden" value="1">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="name" id="label_name" class="col-sm-2 control-label">权限</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="name" name="name" placeholder="请输入功能名称">
                                </div>
                            </div>
                            <div class="form-group" id="url_div">
                                <label for="url" class="col-sm-2 control-label">url</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="url" name="url" placeholder="请输入Url"></input>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="icon" class="col-sm-2 control-label">图标</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="icon" name="icon"/>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal" onclick="MenuTree.formReset();">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="MenuTree.save()">保存</button>
                </div>
            </div>
        </div>
    </div>

    <div id="rMenu">
        <a id="m_add" class="list-group-item" onclick="MenuTree.add();">增加权限</a>
        <a id="m_edit" class="list-group-item" onclick="MenuTree.get();">编辑权限</a>
        <a id="m_del" class="list-group-item" onclick="MenuTree.delete();">删除权限</a>

        <a id="m_add_dir" class="list-group-item" onclick="MenuTree.addDir();">增加文件夹</a>
        <a id="m_edit_dir" class="list-group-item" onclick="MenuTree.get();">编辑文件夹</a>
        <a id="m_del_dir" class="list-group-item" onclick="MenuTree.delete();">删除文件夹</a>
    </div>
</div>
</body>
</html>